//
//  UIBarButtonItem+Category.swift
//  swift-微博
//
//  Created by chenrin on 2016/12/15.
//  Copyright © 2016年 zhuoheng. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    class func creatBarButtonItem(imageName:String,target:Any?,action:Selector) -> UIBarButtonItem{
        //1.左边的按钮
        let leftBtn = UIButton()
        leftBtn.setImage(UIImage(named:imageName + "_highlighted"), for: .highlighted)
        leftBtn.setImage(UIImage(named:imageName), for: .normal)
        leftBtn.sizeToFit()
        leftBtn.addTarget(target, action: action, for: .touchUpInside)
       return UIBarButtonItem(customView: leftBtn)
    }
}

